using System;
using System.Drawing;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ADEVSO.Data;
using SmartParking.Bussiness;

namespace SmartParking.Web.Manager
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                (Master as Logger).Title = "SmartParking Manager";
                (Master as Logger).ActiveMenuItem = "Home";
                ParkingManager.BindCustomers(ref ddlCustomer);
                ddlCustomer_SelectedIndexChanged(ddlCustomer, e);
                ddlParking_SelectedIndexChanged(ddlParking, e);
            }
        }
        
        protected void ddlCustomer_SelectedIndexChanged(object sender, EventArgs e)
        {
            ParkingManager.BindParkings(ref ddlParking, Convert.ToInt32(ddlCustomer.SelectedValue));
        }
        
        protected void ddlParking_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (! ddlParking.SelectedValue.Equals(String.Empty))
            {
                ParkingManager.BindParkingZones(ref ddlParkingZone, Convert.ToInt32(ddlParking.SelectedValue));
                ddlParkingZone_SelectedIndexChanged(sender, e);
            }
        }

        protected void ddlParkingZone_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!ddlParkingZone.SelectedValue.Equals(String.Empty))
            {
                Schedule1.ParkingZoneID = Convert.ToInt32(ddlParkingZone.SelectedValue);
            }
        }
    }
}
